﻿using Microsoft.VisualBasic;
using Org.BouncyCastle.Asn1.Mozilla;
using System;
using System.Collections.Generic;
using System.ComponentModel;
//using System.Drawing.Printing;
using System.Linq;
using System.Security.Claims;
using System.Text;
//using System.Threading.Channels;
using System.Threading.Tasks;


namespace DBLibrary.Model.pojo
{
    public class PortPara : INotifyPropertyChanged   ,IDisposable   //端口表
    {
        public event PropertyChangedEventHandler PropertyChanged = delegate { };
        private int _SensorId;                     //       [系统序号]    
        private int _isDelete;                     //      ,[是否已删除]
        private int _isValid;                      //      ,[是否有效]
        private string _SensorName;                //      ,[传感器名称]
        private int _SensorType;                   //      ,[传感器类型]
        private string _SensorModel;               //      ,[传感器规格型号]
        private string _InstallLocation;           //      ,[安装地点]
        private int _BranchAddr;                   //      ,[分站地址]
        private int _PortId;                       //      ,[端口序号]
        private int _IsAnalog;                     //      ,[是否模拟量]
        private string _StopDisplay;               //      ,[停显示]
        private string _OpenDisplay;               //      ,[开显示]
        private string _Unit;                      //      ,[单位]
        private float? _coefficient;               //      ,[系数]
        private float? _BaseValue;                 //      ,[基值]
        private int _isWarning;                    //      ,[是否报警]
        private int _WarningType;                  //      ,[报警方式]
        private float? _HighValue;                 //      ,[报警上限值]
        private float? _HighRemoveValue;           //      ,[报警上限解除值]
        private float? _LowValue;                  //      ,[报警下限值]
        private float? _LowRemoveValue;            //      ,[报警下限解除值]
        private int _isPowerControl;               //      ,[是否断电控制]
        private int _isTerminal;                   //      ,[是否终端断电]
        private int _PowerMethod;                  //      ,[断电方式]
        private float? _PowerValue;                //      ,[断电值]
        private float? _RePowerValue;              //      ,[复电值]
        private int _isMultiControl;               //      ,[是否多路控制]
        private string _PowerOffPort;              //      ,[断电控制端口]
        private int  _IsSynchronousUpdate;         //      ,[是否同步更新]
        private int _IsUpload;                     //      ,[上传否]
        private int _IsUpload2;                    //      ,[上传否2]
        private  float? _AbnormalRatio;            //      ,[异常值判定比率]
        private int? _intervalOfOutliers;          //      ,[异常值判定间隔]
        private int? _lowLimitRange;               //      ,[量程下限]
        private int? _highLimitRange;              //      ,[量程上限]
        private int _DisplayMethod=1;                //      ,[显示方式]
        private string _PowerArea;                 //      ,[断电区域]
        private int _isShielding1;                 //      ,[上传屏蔽否]
        private int _isShielding2;                 //      ,[上传屏蔽否2]
        private int _isShielding3;                 //      ,[上传屏蔽否3]
        private int _isShielding4;                 //      ,[上传屏蔽否4]
        private int _isGradingAlarm;               //      ,[是否分级报警]
        private string _classifyLink;              //      ,[分级联动字串]
        private float? _HighClassify1;             //      ,[分级上限1]
        private float? _HighClassify2;             //      ,[分级上限2]
        private float? _HighClassify3;             //      ,[分级上限3]
        private float? _HighClassify4;             //      ,[分级上限4]
        private int? _ClassifyTime1;               //      ,[分级限时1]
        private int? _ClassifyTime2;               //      ,[分级限时2]
        private int? _ClassifyTime3;               //      ,[分级限时3]
        private int? _ClassifyTime4;               //      ,[分级限时4]
        private float? _LowClassify1;              //      ,[分级下限1]
        private float? _LowClassify2;              //      ,[分级下限2]
        private float? _LowClassify3;              //      ,[分级下限3]
        private float? _LowClassify4;              //      ,[分级下限4]
        private int _isEmergencyLink;              //      ,[是否应急联动]
        private DateTime? LastTime;                //      ,[上次标校时间]
        private int? _workType;                    //      ,[工作面类型]
        private int? _addrType;                    //      ,[地址类型]
        private string _gasSensorId;               //      ,[甲烷传感器编号]
        private string _InstallLocationId;         //      ,[安装地点编号]
        private int? _MarkingCycle;                //      ,[标校周期]
        private int? _MineId;                      //      ,[矿井编号]
        private float _CrossSection;               //      ,[截面积]
        private int _isIgnore;                     //      ,[忽略故障]
        private float? _PowerValue2;               //      ,[断电值2]
        private DateTime? _InstallTime;            //      ,[安装时间]
        private DateTime? DeleteTime;              //      ,[删除时间]
        private int? _twoPowerOffPort1;            //      ,[二次断电端口1]
        private int? _twoPowerOffPort2;            //      ,[二次断电端口2]
        private int? _UpdateTag;                   //      ,[更新标记]
        private string _EquipmentId;               //      ,[设备编号]
        private int _isReportAdd;                  //      ,[是否报表添加]
        private float? _warnRatio;                 //       [预警比例系数]
        private string? _RelateSensor;             //       关联传感器
        private string cameraIp;                    //摄像头ip
        private string cameraUser;                  //摄像头用户名
        private string cameraPass;                  //摄像头密码
        public bool IsEditing = false;
        public delegate void delValueChange(object sender, EventArgs e);
        //委托相关联的事件 


        public override string ToString()
        {
            if (SensorId == 0)
                return "全部";
            return BranchAddr+"- "+PortId+" "+SensorId+"\\"+SensorName+"\\"+InstallLocation;
        }
        public string ToString2()
        {
            return BranchAddr + "-" + PortId + "/"  + SensorName ;
        }

        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }

        public int SensorId { get => _SensorId; 
            set {

                _SensorId = value;
            } 
        }
        public int IsDelete { get => _isDelete;
            set
            {
                _isDelete = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsDelete"));
                }
          
            }
        }
        public int IsValid { get => _isValid;
            set
            {
                _isValid = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsValid"));
                }
     
            }
        }
        public string SensorName { get => _SensorName;
            set
            {
                _SensorName = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("SensorName"));
                }

            }
        }
        public int SensorType { get => _SensorType;
            set
            {
                _SensorType = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("SensorType"));
                }

            }
        }
        public string SensorModel { get => _SensorModel;
            set
            {
                _SensorModel = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("SensorModel"));
                }

            }
        }
        public string InstallLocation { get => _InstallLocation;
            set
            {
                _InstallLocation = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("InstallLocation"));
                }

            }
        }
        public int BranchAddr { get => _BranchAddr;
            set
            {
                _BranchAddr = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("BranchAddr"));
                }

            }
        }
        public int PortId { get => _PortId;
            set
            {
                _PortId = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PortId"));
                }

            }
        }
        public int IsAnalog { get => _IsAnalog;
            set
            {
                _IsAnalog = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsAnalog"));
                }

            }
        }
        public string StopDisplay { get => _StopDisplay;
            set
            {
                _StopDisplay = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("StopDisplay"));
                }

            }
        }
        public string OpenDisplay { get => _OpenDisplay;
            set
            {
                _OpenDisplay = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("OpenDisplay"));
                }

            }
        }
        public string Unit { get => _Unit;
            set
            {
                _Unit = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Unit"));
                }

            }
        }
        public float? Coefficient { get => _coefficient;
            set
            {
                _coefficient = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Coefficient"));
                }

            }
        }
        public float? BaseValue { get => _BaseValue; set
            {
                _BaseValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("BaseValue"));
                }
  
            }
        
        }
        public int IsWarning { get => _isWarning;
            set
            {
                _isWarning = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsWarning"));
                }

            }
        }
        public int WarningType { get => _WarningType;
            set
            {
                _WarningType = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("WarningType"));
                }

            }
        }
        public float? HighValue { get => _HighValue; set
            {
                _HighValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("HighValue"));
                }

            }
        
        }
        public float? HighRemoveValue { get => _HighRemoveValue; 
            set
            {
                _HighRemoveValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("HighRemoveValue"));
                }

            }
        }
        public float? LowValue { get => _LowValue;
            set
            {
                _LowValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("LowValue"));
                }

            }
        }
        public float? LowRemoveValue { get => _LowRemoveValue; set
            {
                _LowRemoveValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("LowRemoveValue"));
                }

            }
        
        }
        public int IsPowerControl { get => _isPowerControl;
            set
            {
                _isPowerControl = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsPowerControl"));
                }
           
            }
        }
        public int IsTerminal { get => _isTerminal;
            set
            {
                _isTerminal = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsTerminal"));
                }

            }
        }
        public int PowerMethod { get => _PowerMethod;
            set
            {
                _PowerMethod = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PowerMethod"));
                }
     
            }
        }
        public float? PowerValue { get => _PowerValue;
            set
            {
                _PowerValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PowerValue"));
                }

            }
        }
        public float? RePowerValue { get => _RePowerValue;
            set
            {
                _RePowerValue = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("RePowerValue"));
                }

            }
        }
        public int IsMultiControl { get => _isMultiControl;
            set
            {
                _isMultiControl = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsMultiControl"));
                }

            }
        }
        public string PowerOffPort { get => _PowerOffPort;
            set
            {
                _PowerOffPort = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PowerOffPort"));
                }

            }
        }
        public int IsSynchronousUpdate { get => _IsSynchronousUpdate;
            set
            {
                _IsSynchronousUpdate = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsSynchronousUpdate"));
                }
 
            }
        }
        public int IsUpload { get => _IsUpload;
            set
            {
                _IsUpload = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsUpload"));
                }

            }
        }
        public int IsUpload2 { get => _IsUpload2;
            set
            {
                _IsUpload2 = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IsUpload2"));
                }

            }
        }
        public float? AbnormalRatio { get => _AbnormalRatio;
            set
            {
                _AbnormalRatio = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("AbnormalRatio"));
                }

            }
        }
        public int? IntervalOfOutliers { get => _intervalOfOutliers;
            set
            {
                _intervalOfOutliers = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("IntervalOfOutliers"));
                }

            }
        }
        public int? LowLimitRange { get => _lowLimitRange;
            set
            {
                _lowLimitRange = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("LowLimitRange"));
                }

            }
        }
        public int? HighLimitRange { get => _highLimitRange;
            set
            {
                _highLimitRange = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("HighLimitRange"));
                }

            }
        }
        public int DisplayMethod { get => _DisplayMethod;
            set
            {
                _DisplayMethod = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("DisplayMethod"));
                }

            }
        }
        public string PowerArea { get => _PowerArea;
            set
            {
                _PowerArea = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("PowerArea"));
                }

            }
        }
        public int IsShielding1 { get => _isShielding1; set => _isShielding1 = value; }
        public int IsShielding2 { get => _isShielding2; set => _isShielding2 = value; }
        public int IsShielding3 { get => _isShielding3; set => _isShielding3 = value; }
        public int IsShielding4 { get => _isShielding4; set => _isShielding4 = value; }
        public int IsGradingAlarm { get => _isGradingAlarm; set => _isGradingAlarm = value; }
        public string ClassifyLink { get => _classifyLink; set => _classifyLink = value; }
        public float? HighClassify1 { get => _HighClassify1; set => _HighClassify1 = value; }
        public float? HighClassify2 { get => _HighClassify2; set => _HighClassify2 = value; }
        public float? HighClassify3 { get => _HighClassify3; set => _HighClassify3 = value; }
        public float? HighClassify4 { get => _HighClassify4; set => _HighClassify4 = value; }
        public int? ClassifyTime1 { get => _ClassifyTime1; set => _ClassifyTime1 = value; }
        public int? ClassifyTime2 { get => _ClassifyTime2; set => _ClassifyTime2 = value; }
        public int? ClassifyTime3 { get => _ClassifyTime3; set => _ClassifyTime3 = value; }
        public int? ClassifyTime4 { get => _ClassifyTime4; set => _ClassifyTime4 = value; }
        public float? LowClassify1 { get => _LowClassify1; set => _LowClassify1 = value; }
        public float? LowClassify2 { get => _LowClassify2; set => _LowClassify2 = value; }
        public float? LowClassify3 { get => _LowClassify3; set => _LowClassify3 = value; }
        public float? LowClassify4 { get => _LowClassify4; set => _LowClassify4 = value; }
        public int IsEmergencyLink { get => _isEmergencyLink; set => _isEmergencyLink = value; }
        public DateTime? LastTime1 { get => LastTime; set => LastTime = value; }
        public string InstallLocationId { get => _InstallLocationId; set => _InstallLocationId = value; }
        public int IsIgnore { get => _isIgnore; set => _isIgnore = value; }
        public int? WorkType { get => _workType; set => _workType = value; }
        public int? AddrType { get => _addrType; set => _addrType = value; }
        public string GasSensorId { get => _gasSensorId; set => _gasSensorId = value; }
        public int? MarkingCycle { get => _MarkingCycle; set => _MarkingCycle = value; }
        public float CrossSection { get => _CrossSection; set => _CrossSection = value; }
        public int? MineId { get => _MineId; set => _MineId = value; }
        public float? PowerValue2 { get => _PowerValue2; set => _PowerValue2 = value; }
        public DateTime? InstallTime { get => _InstallTime; set => _InstallTime = value; }
        public DateTime? DeleteTime1 { get => DeleteTime; set => DeleteTime = value; }
        public int? TwoPowerOffPort1 { get => _twoPowerOffPort1; set => _twoPowerOffPort1 = value; }
        public int? TwoPowerOffPort2 { get => _twoPowerOffPort2; set => _twoPowerOffPort2 = value; }
        public int? UpdateTag { get => _UpdateTag; set => _UpdateTag = value; }
        public string EquipmentId { get => _EquipmentId; set => _EquipmentId = value; }
        public int IsReportAdd { get => _isReportAdd; set => _isReportAdd = value; }

        public string? RelateSensor { get => _RelateSensor;
            set
            {
                _RelateSensor = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("RelateSensor"));
                }
 
            }
        }
        public float? WarnRatio { get => _warnRatio; set => _warnRatio = value; }
        public string CameraIp { get => cameraIp;
            set
            {
                cameraIp = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CameraIp"));
                }
            }
        }
        public string CameraUser { get => cameraUser;
            set
            {
                cameraUser = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CameraUser"));
                }
            }
        }
        public string CameraPass { get => cameraPass;
            set
            {
                cameraPass = value;
                if (PropertyChanged != null)
                {
                    IsEditing = true;
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CameraPass"));
                }
            }
        }
    }
}
